<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
    <title>悦章科技机构平台</title>
    <script src="/Public/static/jquery-2.0.3.min.js"></script>
    <script src="/Public/static/layer/layer.js"></script>
    <!--内容样式-->
    <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css" />
    <link rel="stylesheet" href="__PUBLIC__/Home/css/page.css" />

</head>

<body>
<div class="main">
    <!--  头部  -->
    <include file="menu" />

    <!--  右侧内容  -->
    <div class="content">


        <div class= "ct-title">
            <div class="ctt-bt">新增老师</div>
            <div class="divclear"></div>
        </div>

        <div class="ct-xz">
            <form action="{:U('Home/Mechanism/addFaculty')}" method="post" class="form-horizontal">
                <div class="ctx-box">
                    <div class="ctxb-l">老师姓名：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入老师姓名" class="ctxbr-wb" name="name">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">标签：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入标签" class="ctxbr-wb" name="tag">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">个性签名：</div>
                    <div class="ctxb-r">
                        <input type="text" placeholder="请输入20字内的个性签名" class="ctxbr-wb" name="sign">
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box" style="width: 100%;">
                    <div class="ctxb-l">所属板块：</div>
                    <div class="ctxb-bk">
                        <volist name="section" id="vo">
                            <label class="ctxbb-box">
                                <input type="checkbox" name="section_ids[]" value="{$vo.id}">
                                <span>{$vo.name}</span>
                                <div class="divclear"></div>
                            </label>
                        </volist>
                        <div class="divclear"></div>
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="divclear"></div>
                <div class="ctx-box">
                    <div class="ctxb-l">老师简介：</div>
                    <div class="ctxb-r">
                        <textarea placeholder="请输入老师简介..." class="ctxbr-wbk" name="desc"></textarea>
                    </div>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">头像：</div>
                    <input type="file" id="avatar_img_file" style="display: none">
                    <input type="hidden" name="avatar_id" id="avatar_id" value=""/>
                    <div class="ctxb-r" style="width: 184px;padding: 0;border: 1px dashed #ccc;">
                        <div class="ctxbr-img">
                            <img src="__PUBLIC__/Home/images/img_sctp.png" id="avatar_Img"/>
                        </div>
                        <div class="ctxbr-sc">
                            <img src="__PUBLIC__/Home/images/icon_sc.png" id="delAvatarImg"/>
                        </div>
                        <div style="position: absolute; white-space: nowrap; width: 100%; font-size: 12px; height: 16px; color: #999; text-align: justify; margin: 10 0 0 100px">
                推荐尺寸：184px * 184px
            </div>
                    </div>
                    <script type="text/javascript">
                        $("#avatar_Img").click(function (){
                            $("#avatar_img_file").trigger("click");
                        })
                        $('#avatar_img_file').change(function (){
                            var pic = $(this)[0].files[0];
                            var formData = new FormData();
                            var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                            formData.append('download', pic);
                            $.ajax({
                                url:url,
                                type:"post",
                                data: formData,
                                cache: false,
                                contentType: false,
                                processData: false,
                                success:function(data){
                                    //console.log(data);
                                    if(data.status == 1){
                                        //上传成功
                                        var id = data.id;
                                        var path = data.path;

                                        $('#avatar_id').val(id);
                                        $('#avatar_Img').attr('src', path);
                                    }else{
                                        layer.msg(data.info);
                                    }
                                }
                            });
                        });

                        //删除图片
                        $("#delAvatarImg").click(function(){
                            $('#avatar_id').val("");
                            $('#avatar_Img').attr('src', "__PUBLIC__/Home/images/img_sctp.png");
                            let input = document.getElementById('avatar_img_file');
                            input.value = ''
                        })
                    </script>
                    <div class="divclear"></div>
                </div>
                <div class="ctx-box">
                    <div class="ctxb-l">封面图：</div>
                    <input type="file" id="cover_img_file" style="display: none">
                    <input type="hidden" name="cover_id" id="cover_id" value=""/>
                    <div class="ctxb-r" style="width: calc(100% - 176px);padding: 0;border: 1px dashed #ccc;">
                        <div class="ctxbr-img">
                            <img src="__PUBLIC__/Home/images/img_sctp.png" id="cover_Img"/>
                        </div>
                        <div class="ctxbr-sc">
                            <img src="__PUBLIC__/Home/images/icon_sc.png" id="delCoverImg"/>
                        </div>
                        <div style="position: absolute; white-space: nowrap; width: 100%; font-size: 12px; height: 16px; color: #999; text-align: justify; margin: 10 0 0 100px">
                推荐尺寸：324px * 184px
            </div>
                    </div>
                    <script type="text/javascript">
                        $("#cover_Img").click(function (){
                            $("#cover_img_file").trigger("click");
                        })
                        $('#cover_img_file').change(function (){
                            var pic = $(this)[0].files[0];
                            var formData = new FormData();
                            var url="{:U('File/uploadPicture',array('session_id'=>session_id()))}";
                            formData.append('download', pic);
                            $.ajax({
                                url:url,
                                type:"post",
                                data: formData,
                                cache: false,
                                contentType: false,
                                processData: false,
                                success:function(data){
                                    //console.log(data);
                                    if(data.status == 1){
                                        //上传成功
                                        var id = data.id;
                                        var path = data.path;

                                        $('#cover_id').val(id);
                                        $('#cover_Img').attr('src', path);
                                    }else{
                                        layer.msg(data.info);
                                    }
                                }
                            });
                        });

                        //删除图片
                        $("#delCoverImg").click(function(){
                            $('#cover_id').val("");
                            $('#cover_Img').attr('src', "__PUBLIC__/Home/images/img_sctp.png");
                            let input = document.getElementById('cover_img_file');
                            input.value = ''
                        })
                    </script>
                    <div class="divclear"></div>
                </div>
                <div class="divclear"></div>
                <button class="ctx-btn">确认</button>
            </form>
        </div>
    </div>
</div>
</body>
</html>
